
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Private Key, Public Key, Signature, AES, Encryption / Decryption
import ecc from 'eosjs-ecc'
// or
const ecc = require('eosjs-ecc')
Type: string
Parameters
cpuEntropyBits
number gather additional entropy
from a CPU mining algorithm. Set to 0 for testing. (optional, default 128
)Examples
ecc.randomKey()
Returns wif
Parameters
seed
string any length string. This is private. The same
seed produces the same private key every time. At least 128 random
bits should be used to produce a good private key.Examples
ecc.seedPrivate('secret') === wif
Returns wif
Parameters
wif
wifExamples
ecc.privateToPublic(wif) === pubkey
Returns pubkey
Parameters
pubkey
pubkey like EOSKey..Examples
ecc.isValidPublic(pubkey) === true
Returns boolean valid
Parameters
wif
wifExamples
ecc.isValidPrivate(wif) === true
Returns boolean valid
Create a signature using data or a hash.
Parameters
data
(string | Buffer)privateKey
(wif | PrivateKey)hashData
boolean sha256 hash data before signing (optional, default true
)Examples
ecc.sign('I am alive', wif)
Returns string hex signature
Verify signed data.
Parameters
signature
(string | Buffer) buffer or hex stringdata
(string | Buffer)pubkey
(pubkey | PublicKey)hashData
boolean sha256 hash data before verify (optional, default true
)Examples
ecc.verify(signature, 'I am alive', pubkey) === true
Returns boolean
Recover the public key used to create the signature.
Parameters
signature
String (hex, etc..)data
(String | Buffer)hashData
boolean sha256 hash data before recover (optional, default true
)Examples
ecc.recover(signature, 'I am alive') === pubkey
Returns pubkey
Parameters
Examples
ecc.sha256('hashme') === '02208b..'
Returns (string | Buffer) Buffer when encoding is null, or string
EOSKey..
Type: string
let {PrivateKey, PublicKey, Signature, Aes, key_utils, config} = require('eosjs-ecc')
// Create a new random private key
privateWif = PrivateKey.randomKey().toWif()
// Convert to a public key
pubkey = PrivateKey.fromWif(privateWif).toPublic().toString()
git clone https://github.com/EOSIO/eosjs-ecc.git
cd eosjs-ecc
npm install
npm run build
# builds: ./dist/eosjs-ecc.js
# Verify release hash
<script src=eosjs-ecc.js></script>
var ecc = eosjs_ecc
var privateWif = ecc.randomKey()
var pubkey = ecc.privateToPublic(privateWif)
console.log(pubkey)
const {config} = require('eosjs-ecc')
// Change the public key address prefix
// config.address_prefix = 'XXX'
See Config
FAQs
Elliptic curve cryptography functions
The npm package eosjs-ecc receives a total of 19,267 weekly downloads. As such, eosjs-ecc popularity was classified as popular.
We found that eosjs-ecc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.